import os.path

import requests
from settings import upload_img_dir
import pymysql

header = {"Authorization": "bearer0ff5d04c-bf03-4b3f-8407-a84bd49c36d6"}

resp = requests.request("post", "http://mall.lemonban.com:8108/adminLogin",
                        json={
                            "principal": "student",
                            "credentials": "123456a",
                            "imageCode": "lemon"
                        })
token = resp.json()["access_token"]


upload_img = os.path.join(upload_img_dir, "test1.png")
resp = requests.request(method="post",
                        url="http://mall.lemonban.com:8108/admin/file/upload/img",
                        headers={"Authorization": f"bearer{token}"},
                        files={"file": ("test1.png", open(upload_img, "rb"), "image/png")}
                        )





